<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>淘有货后台管理系统</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <%--<link rel="shortcut icon" href="${pageContext.request.contextPath}/font/favicon.ico" type="image/x-icon"/>--%>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/main/font.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/main/xadmin.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/swiper.min.css">
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/js/login/jquery.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/js/swiper.jquery.min.js"></script>
    <script src="${pageContext.request.contextPath}/static/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/js/main/xadmin.js"></script>

</head>
<body style="height: 200px;">
<!-- 中部开始 -->
<div class="wrapper">
    <!-- 右侧主体开始 -->
    <div class="page-content">
        <div class="content">
            <!-- 右侧内容框架，更改从这里开始 -->
            <form class="layui-form" style="overflow:hidden;">
                <div class="layui-form-item">
                    <label for="cname" class="layui-form-label">
                        <span class="x-red">*</span>分类名称
                    </label>
                    <div class="layui-input-inline">
                        <input type="text" style="width: 80%;" id="cname" name="cname" class="layui-input" required="" value="${category.cname}">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label for="editCategoty" class="layui-form-label">
                    </label>
                    <input type="button" id="editCategoty" onclick="edit_category('${category.cid}')" value="修改"
                           class="layui-btn">

                    </input>
                </div>
            </form>
            <!-- 右侧内容框架，更改从这里结束 -->
        </div>
    </div>
    <!-- 右侧主体结束 -->
</div>
<!-- 中部结束 -->

</body>

<script>
    edit_category = function (cid) {
        $.ajax({
            type: "post",
            url: "${pageContext.request.contextPath}/category/editCategory.do",
            data: {
                cid: cid,
                cname: $("#cname").val()
            },
            success: function (s) {
                if (s.success) {
                    layer.msg("修改成功",{
                        icon:1,
                        time:1000
                    })
                    x_admin_close();
                } else {
                    layer.msg("修改失败",{
                        icon:1,
                        time:1000
                    })
                    x_admin_close();

                }
            }
        })
    }
</script>
</html>